// 	Name: 09.c
//	Description: Chapter 6 project 9
//	Author: StableGenius
//	Date: 2020-07-09
//	Email: feng@dongfa.pro

#include <stdio.h>

int main(void){
	float loan, rate, payment;
	int num_of_pay;

	printf("Enter amount of loan: ");
	scanf("%f", &loan);

	printf("Enter interest rate: ");
	scanf("%f", &rate);

	printf("Enter monthly payment: ");
	scanf("%f", &payment);

	printf("Enter number of payment: ");
	scanf("%d", &num_of_pay);

	for (int i = 0; i < num_of_pay; i++)
	{
		printf("Balance remaining after %d payment: $%.2f\n", 
			i + 1, 
			loan = loan - payment + loan * rate / 100.0f / 12.0f);
	}

	return 0;
}